//
// dates.h
// libprotea
// Tools Library for the Protea Project / Date-handling functions for Fields
// Copyright (C) 2003, 2004, 2005 eXegeSys, Inc.
// Copyright (C) 2008 Bruce A. James
//
// This program is part of the Protea Project.
//
// The Protea Project is free software; you can redistribute it and/or modify it 
// under the terms of the GNU General Public License as published by the 
// Free Software Foundation, either version 3 of the License, or (at your 
// option) any later version.
//
// The Protea Project is distributed in the hope that it will be useful, but 
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
// for more details.
// 
// You should have received a copy of the GNU General Public License along 
// with this program.  If not, see <http://www.gnu.org/licenses/>.
// 
// Please send correspondence to:
// 
// theproteaproject@gmail.com
//

#ifndef __PROTEA_DATES_H__
#define __PROTEA_DATES_H__

#include "field_defns.h"

bool text_to_julian( char* text_ptr, const date_form_type& date_format, double& JD, long len, long& err_num );
bool julian_to_text( double JD, const date_form_type& date_format, char* text_ptr, long& len, long& err_num );

bool convert_to_gregorian( double JD, date_conv_type& date, long& err_num );
bool gregorian_to_text( date_conv_type& date, const date_form_type& date_format, char* text_ptr, long& len, long& err_num );

bool convert_month( char* month_string, int month_string_length, int& month, long& err_num );
bool convert_to_julian( double& julian_date, date_conv_type& date, long& err_num );
bool M_A0_00_TO_A0( char* source, char* target, long& error );
bool M_A0_00_TO_2D( char* source, int& year_2d, long& error );

//bool MCONVERT_MONTH( char* month_string, long month_string_length, long month, long& err );
//bool MCONVERT_TO_JULIAN( long& julian_date, long day, long month, long year, long& err );
//bool M_A0_00_TO_A0( char* source, char* target, long& err );
//bool M_A0_00_TO_2D( char* source, long& year, long& err );

long BINARY( char* data, int len );

#endif
